package cn.ytzb.controller;

import cn.ytzb.pojo.Admin;
import cn.ytzb.service.AdminService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class AdminController {

    @Resource
    private AdminService adminService;

    @GetMapping("/get/{id}")
    public Admin finById(@PathVariable Integer id) {
        Admin admin = adminService.findById(id);
        return admin;
    }
    @RequestMapping("/getAll")
    public List<Admin> getAll(){
        return adminService.getAll();
    }
}
